import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024 —03 —11
 * Time: 10:05
 */
public class test_3_11 {


        public int firstUniqChar (String s){
            int [] Current = new int[26];
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                Current[ch  - 'a'] ++;
            }
            //遍历字符串 用charAt 获取字符串的每一个字符
            //在用每个字符减去‘a’得到的数字放到数组中，于是 比如'a'-'a''=0
            //放在数组的0下标位置
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (Current[ ch-'a'] == 1){
                    System.out.println(i);
                    return 0;
                }
            }
            System.out.println("-1");
            return 0;
        }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入字符串");
        String str = scanner.nextLine();
        test_3_11 test31 = new test_3_11();
        test31.firstUniqChar(str);
    }




}
